<template>
	<view style="width: 100vw;display: flex;justify-content: center;">
		<view class="page-content">
			<view style="display: flex;justify-content: end;">
				<view class="add-btn" @click="cancel">
					<span class="btn-text">返回</span>
				</view>
			</view>
			<view class="title">设备 {{devicename}} 7日稼动率</view>

			<view style="display: flex;justify-content: center;margin-top: 8vh;margin-bottom: 2.8vh;">
				<view style="background:rgba(13,46,105, 0.41);border-radius: 8px;width: 50vw;height: 41vh">
				<!-- chart -->
				
					<view class="chart-map">
						<view class="charts-box">
							<qiun-data-charts type="area" :opts="opts2" :chartData="chartData2" />
						</view>
					</view>
				
				</view>
			</view>
			
		
			

		</view>
	</view>

</template>

<script>
	import config from '@/config.js'
	
	import {
		SevenDaysDeviceUtility
	} from '@/api/device.js'
	
	export default {
		data() {
			return {
				devicename:"",
				chartData2:{
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['area'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts2: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [45, 25, 50, 10],
					enableScroll: false,
					legend: {
						show: true,
						fontColor: "#ffffff"
					},
				
					xAxis: {
						disableGrid: true,
						fontColor: "#ffffff",
					},
					yAxis: {
						gridType: "solid",
						gridColor: "#1f2d3c",
						data: [{
							min: 0,
							max: 150,
							fontColor: "#ffffff",
				
						}]
					},
					extra: {
						area: {
							type: "curve",
							opacity: 0.2,
							addLine: true,
							width: 2,
							gradient: true,
							activeType: "hollow",
				
						}
					},
				}
			}
		},
		created() {
		},
		methods: {
			setdevicename(name)
			{
				
				this.devicename=name;
			},
			getdeviceultility(name) {
				this.devicename=name;
				//弹出详情显示
				 SevenDaysDeviceUtility({
					data: {
						devicename: this.devicename
					}
				}).then(res => {
					if (res.data.statuscode == 1) {
						console.log("%%%%%%%%%%%%%", res.data.data)
				        // this.dataList=res.data.data
						let tempchartData2 = {
							categories: ["2018", "2019", "2020", "2021", "2022", "2023", "2024"],
							series: [{
									name: "稼动率",
									data: [0, 19, 0, 0, 0, 0, 0],
									textColor: "#ffffff"
								},
						
							]
						};
						
						let sevendays = res.data.data
						let i1 = 0;
						sevendays.forEach((item, index) => {
								tempchartData2.categories[i1] = item["CREATETIME"]
								tempchartData2.series[0].data[i1] = item["UtilizationRate"]
								i1 += 1;
							}
						
						)
						this.chartData2 = tempchartData2
						
					} else {
						console.log('Error:MeasureResult failed');
					}
				
				});
				
			},
			
			cancel(){
				this.$emit("showInfo")
			},
			
			
		}
	}
</script>

<style scoped>
	/* // 设置下拉框的背景颜色及边框属性； */
	/deep/.el-select-dropdown {
		// 若不将下拉框的背景颜色设置为：transparent，那么做不出来半透明的效果；
		// 因为其最终的显示为：下拉框有一个背景颜色且下拉框的字体有一个背景颜色，重叠后的效果展示；
		/* background-color: transparent; */
		border: none;
	}

	/* // 设置下拉框的字体属性及背景颜色； */
	.el-select-dropdown__item {
		color: #fff;
		background-color: #004289;
	}

	/* // 设置下拉框列表的 padding 值为：0；(即：样式调整) */
	/deep/.el-select-dropdown__list {
		padding: 0;
	}

	/* // 设置输入框与下拉框的距离为：0; (即：样式调整) */
	/deep/.el-popper[x-placement^="bottom"] {
		margin-top: 0px;
	}

	/* // 将下拉框上的小箭头取消；(看着像一个箭头，其实是两个重叠在一起的箭头) */
	/deep/.el-popper .popper__arrow,
	/deep/.el-popper .popper__arrow::after {
		display: none;
	}

	/* // 设置鼠标悬停在下拉框列表的悬停色； */
	.el-select-dropdown__item:hover {
		background-color: rgba(0, 136, 255, 0.8);
	}

	.def-text {
		width: 30%;
		position: relative;
		z-index: 1;
		font-family: SourceHanSansSC-Regular;
		font-size: 16px;
		color: #FFFFFF;
		letter-spacing: 0;
		line-height: 22.4px;
		font-weight: 400;
	}

	.btn-text {
		font-family: SourceHanSansSC-Normal;
		font-size: 16px;
		color: #FFFFFF;
		letter-spacing: 1.6px;
		text-align: center;
		line-height: 26.4px;
		font-weight: 400;
	}

	.add-btn {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7.9vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 2vh;
		margin-right: 2vh;
	}
    
	.add-btn1 {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 2vh;
		margin-right: 2vh;
	}
	
	.sub-btn {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7.9vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.chart-map {
		background-image: url('../../static/imgPc/稼动率板块 背景@2x.png');
		background-size: 100% 100%;
		height: 800rpx;
		overflow: hidden;
		margin-top: 20rpx;
	}
	.charts-box {
		width: 100%;
		height: 100%;
		padding: 50px 20px 15px 20px;
	}
</style>